audio: use zephyr/cache.h for cache flush/invalidate#10258
Merged
kv2019i merged 1 commit intothesofproject:mainfrom Sep 26, 2025
Merged
audio: use zephyr/cache.h for cache flush/invalidate#10258kv2019i merged 1 commit intothesofproject:mainfrom
kv2019i merged 1 commit intothesofproject:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the audio subsystem to use Zephyr's native cache interface instead of the legacy rtos/cache.h. This change ensures the audio code can work in user-space contexts when enabled at build time.
Key changes include:
- Replacing legacy dcache_* functions with sys_cache_data_* equivalents
- Updating header includes to use zephyr/cache.h instead of rtos/cache.h
- Converting dcache_writeback_region to sys_cache_data_flush_range and dcache_invalidate_region to sys_cache_data_invd_range
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/include/sof/audio/audio_stream.h | Updates cache writeback calls in audio_stream_writeback function |
| src/audio/copier/copier_ipcgtw.c | Adds zephyr/cache.h include and converts cache invalidate calls |
| src/audio/buffers/ring_buffer.c | Adds zephyr/cache.h include and updates all cache operations in ring buffer functions |
| src/audio/buffers/comp_buffer.c | Replaces rtos/cache.h with zephyr/cache.h and updates buffer_zero function |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
lyakh
reviewed
Sep 25, 2025
| dcache_writeback_region((__sparse_force void __sparse_cache *)buffer->addr, | ||
| tail_size); | ||
| sys_cache_data_flush_range((__sparse_force void __sparse_cache *)buffer->addr, | ||
| tail_size); |
Collaborator
There was a problem hiding this comment.
should we replace "rtos/cache.h" in this file too?
Collaborator
Author
There was a problem hiding this comment.
D'oh, missed that. V2 uploaded to fix this.
Use Zephyr native cache interface instead of legacy rtos/cache.h. This ensures audio code is using interfaces that supports use from user-space (if enabled at build time). Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
059f903 to
b8e2456
Compare
softwarecki
approved these changes
Sep 25, 2025
lyakh
approved these changes
Sep 26, 2025
iuliana-prodan
approved these changes
Sep 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use Zephyr native cache interface instead of legacy rtos/cache.h. This ensures audio code is using interfaces that supports use from user-space (if enabled at build time).